﻿package com.saint.bitmapDistortion 
{
	import com.saint.bitmapDistortion.animations.IStretchyAnimation;
	import com.saint.bitmapDistortion.animations.SuckbottomMiddle;
	import com.saint.bitmapDistortion.animations.SuckToPoint;
	import com.saint.bitmapDistortion.animations.TwistTopFirst;
	import com.saint.utils.Logger;
	/**
	 * class controlling the predefined animations of the stretcy images
	 * 
	 * @author kembera
	 */
	public class StretchyElasticImageAnimator extends StretchyImageAnimator
	{
		
		public static const TWIST_TOP_FIRST:String = "StretchyImageAnimator Twist top first";
		
		private var animation:IStretchyAnimation;
		
		public function StretchyElasticImageAnimator() 
		{
			super()
			Logger.info("StretchyElasticImageAnimator");			
		}

		
		/**
		 * sorts which animation we need -
		 * 
		 * bad bad data object!
		 * 
		 * @param	image
		 * @param	animationType
		 * @param	data
		 */
		public override function animateImage(image:IStretchyImage, animationType:String, data:Object= null):void
		{
			//super.animateImage(image, animationType, data);
			Logger.info("StretchyImageAnimator.animateImage");
			switch(animationType)
			{
				case TWIST_TOP_FIRST:
					animation = new TwistTopFirst(image);	
					startAnimation();
				break;
				
					
				
				default:
					throw new Error("StretchyElasticImageAnimator.animateImage UNKNOWN IMAGE TYPE");
				break;
			}
		}
		
		public override function startAnimation():void
		{
			animation.startAnimation();
		}
		
		
		
	}

}